package ltd.newbee.mall.api;

import ltd.newbee.mall.entity.HotKeyword;
import ltd.newbee.mall.service.HotKeywordService;
import ltd.newbee.mall.util.Result;
import ltd.newbee.mall.util.ResultGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Classname HotkeyController
 * @Description TODO
 * @auth after
 * @since 2023/3/12 18:32
 */

@RestController
@RequestMapping("/hotkey")
public class HotkeyController {

    @Autowired
    private HotKeywordService keywordService;

    @GetMapping
    public Result<List<HotKeyword>> keywordList(@RequestParam("keyword") String keyword){
        return ResultGenerator.genSuccessResult(keywordService.getHotKeyList(keyword));
    }
}
